﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using edu.Model;
using edu.Service;

namespace edu.ztest
{
    public partial class DailyBehaviorTest : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            int id = 0;
            id= ClassService.Add(new Class() {Name="qwerer" , Code="erew"});
            addTest();
            updateTest();
        }

        
        private void addTest()
        {
            DailyBehavior db = new DailyBehavior();
            db.Name = "name";
            db.Code = "code";
            db.Description = "description";
            db.BehaviorId = 1;
            db.StudentId = 2;
            DateTime curDate = DateTime.Now;
            db.Year = curDate.Year;
            db.Month = curDate.Month;
            db.Day =curDate.Day;
            DailyBehaviorService.Add(db);
        }

        
        private void updateTest()
        {
            List<DailyBehavior> list = new List<DailyBehavior>();

            DailyBehavior db = new DailyBehavior();
            db.Id = 0;
            db.Name = "name";
            db.Code = "code";
            db.Description = "description";
            db.BehaviorId = 3;
            db.StudentId = 4;
            DateTime curDate = DateTime.Now;
            db.Year = curDate.Year;
            db.Month = curDate.Month;
            db.Day = curDate.Day;
            list.Add(db);

            db = new DailyBehavior();
            db.Id = 0;
            db.Name = "name";
            db.Code = "code";
            db.Description = "description";
            db.BehaviorId = 5;
            db.StudentId = 6;
            db.Year = curDate.Year;
            db.Month = curDate.Month;
            db.Day = curDate.Day;
            list.Add(db);

            db = new DailyBehavior();
            db.Id = 14;
            db.Name = "name";
            db.Code = "code";
            db.Description = "description";
            db.BehaviorId = 11;
            db.StudentId = 20;
            db.Year = curDate.Year;
            db.Month = curDate.Month;
            db.Day = curDate.Day;
            list.Add(db);


            DailyBehaviorService.Save(list);
        }
        
    }
}